package thinker.miracle.ams.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import thinker.miracle.ams.model.InterfaceModel;
import thinker.miracle.ams.service.InterfaceService;
import thinker.miracle.business.base.BaseController;
import thinker.miracle.commons.Result;

/**
 * @author bo.chen
 * 
 * 测试
 *
 */
@Controller
public class InterfaceController extends BaseController {

	@Autowired
	InterfaceService interfaceService;
	
	/**
	 * <p>获取所有的接口信息列表</p>
	 * 
	 * 
	 */
	@ResponseBody
	@RequestMapping(value="interface/getInterfaces",method={RequestMethod.GET,RequestMethod.POST})
	public void getInterfaces() {
		Result result = this.getResult();
		try{
			List<InterfaceModel> results = interfaceService.getInterfaces();
			result.addData("data", results).success();
		}catch(Exception e){
			logger.error("",e);
		}
		writeJson(result);
	}
}
